Skip to content

NCO-63: Fix DDL query handling in streaming mode#62

Merged
davidkelly merged 2 commits into
masterfrom
dk/63
May 8, 2026
Merged

NCO-63: Fix DDL query handling in streaming mode#62
davidkelly merged 2 commits into
masterfrom
dk/63

Conversation

@davidkelly
Copy link
Copy Markdown
Collaborator

SDK:

  • Handle responses without "results" array (DDL statements like CREATE/DROP DATABASE)
  • Skip unknown JSON attributes (signature, plans, etc.) to avoid stream corruption
  • Add unit tests for DDL response handling

Performer:

  • Make CloseQueryResult idempotent to handle close-after-cancel

SDK:
- Handle responses without "results" array (DDL statements like CREATE/DROP DATABASE)
- Skip unknown JSON attributes (signature, plans, etc.) to avoid stream corruption
- Add unit tests for DDL response handling

Performer:
- Make CloseQueryResult idempotent to handle close-after-cancel
- Add disableConsoleRead argument for headless Docker operation
@davidkelly davidkelly marked this pull request as ready for review May 7, 2026 01:31
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the analytics streaming result parser to correctly handle non-row (DDL) responses and avoid JSON stream desynchronization when extra top-level attributes are present, and it adjusts the FIT performer to tolerate close-after-cancel behavior.

Changes:

  • Update StreamingAnalyticsResult to initialize successfully when the response has no "results" array and to skip/consume unknown top-level JSON attributes to prevent stream corruption.
  • Add unit tests + a new JSON fixture covering DDL responses with no rows/results.
  • Make the FIT performer’s CloseQueryResult idempotent and add a headless mode option to avoid blocking on console input.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/Couchbase.Analytics.UnitTests/JsonDocuments/ddlResponse.json Adds a representative DDL success response fixture with no results array and extra attributes.
tests/Couchbase.Analytics.UnitTests/Internal/StreamingAnalyticsResultTests.cs Adds tests validating DDL initialization, empty enumeration, and metrics availability.
tests/Couchbase.Analytics.UnitTests/Couchbase.Analytics.UnitTests.csproj Ensures the new DDL fixture is copied to the test output directory.
src/Couchbase.Analytics/Internal/Results/StreamingAnalyticsResult.cs Implements “no results array” handling and consumes unknown attributes to keep the stream reader aligned.
fit/Couchbase.Analytics.Performer/Program.cs Adds disableConsoleRead mode for headless operation.
fit/Couchbase.Analytics.Performer/Internal/Services/AnalyticsPerformerCrossService.cs Makes CloseQueryResult idempotent by succeeding even if the handle was already removed.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread fit/Couchbase.Analytics.Performer/Program.cs Outdated
our robot overlords are right on this one

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@davidkelly davidkelly merged commit ba913b5 into master May 8, 2026
3 checks passed
@davidkelly davidkelly deleted the dk/63 branch May 8, 2026 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants